package com.lczyfz.campusinfo.modules.campusinfoeducation.web;

import com.lczyfz.campusinfo.common.persistence.Page;
import com.lczyfz.campusinfo.common.utils.ApiResultUtils;
import com.lczyfz.campusinfo.common.web.BaseController;
import com.lczyfz.campusinfo.modules.campusinfoeducation.entity.UpStudy;
import com.lczyfz.campusinfo.modules.campusinfoeducation.service.UpStudyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

@Controller
@RequestMapping(value = "api/campusinfoeducation/upStudy")
public class upStudyApiController extends BaseController {
    @Autowired
    private UpStudyService upStudyService;
    @RequestMapping(value = "businessList")
    @ResponseBody
    public Map<String, Object> getupstudylist(HttpServletRequest request, HttpServletResponse response) {
        UpStudy upStudy = new UpStudy();
        Page<UpStudy> page = upStudyService.findPage(new Page<UpStudy>(request, response), upStudy);
        Map<String, Object> map = ApiResultUtils.getBaseMapSuccess();
        map.put("page", page.getList());
        map.put("pageNo", page.getPageNo());
        map.put("count", page.getCount());
        map.put("totalPage", page.getTotalPage());
        return map;
    }
}
